package com.example.hfSystem.service.impl;

import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.mapper.Wrapper;
import com.baomidou.mybatisplus.plugins.Page;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import com.example.hfSystem.entity.pojo.Messages;
import com.example.hfSystem.dao.MessagesMapper;
import com.example.hfSystem.service.MessagesService;

import com.example.hfSystem.utils.PageUtils;
import com.example.hfSystem.utils.Query;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

/**
 * <p>
 * 留言板 服务实现类
 * </p>
 *
 * @author <a href="https://fengwenyi.com?fs=mpcg">Erwin Feng</a>
 * @since 2024-04-09
 */
@Service
public class MessagesServiceImpl extends ServiceImpl<MessagesMapper, Messages> implements MessagesService {
    @Override
    public PageUtils queryPage(Map<String, Object> params) {
        Page<Messages> page = this.selectPage(
                new Query<Messages>(params).getPage(),
                new EntityWrapper<Messages>()
        );
        return new PageUtils(page);
    }

    @Override
    public PageUtils queryPage(Map<String, Object> params, Wrapper<Messages> wrapper) {
        Page<Messages> page =new Query<Messages>(params).getPage();
        page.setRecords(baseMapper.selectListView(page,wrapper));
        PageUtils pageUtil = new PageUtils(page);
        return pageUtil;
    }

    @Override
    public List<Messages> selectListVO(Wrapper<Messages> wrapper) {
        return baseMapper.selectListVO(wrapper);
    }

    @Override
    public Messages selectVO(Wrapper<Messages> wrapper) {
        return baseMapper.selectVO(wrapper);
    }

    @Override
    public List<Messages> selectListView(Wrapper<Messages> wrapper) {
        return baseMapper.selectListView(wrapper);
    }

    @Override
    public Messages selectView(Wrapper<Messages> wrapper) {
        return baseMapper.selectView(wrapper);
    }
}
